package fpengine

/*
#cgo CFLAGS		: -I./include
#cgo LDFLAGS	: -lWing
#include <stdlib.h>
#include "fp_sdk.h"
*/
import "C"

// 测试接口
func JxTest(appID, sdkKey, activeKey string) (err error) {

	r := C.jx_test()
	err = newError(int(r), "JxTest")
	return
}

// 测试接口
func JxCv(appID, sdkKey, activeKey string) (err error) {

	r := C.jx_cv()
	err = newError(int(r), "JxCv")
	return
}

// 测试接口
func JxMatting(appID, sdkKey, activeKey string) (err error) {

	r := C.jx_matting()
	err = newError(int(r), "JxMatting")
	return
}

// EngineError SDK错误码
type EngineError struct {
	Code int
	Text string
}

// 实现Error接口
func (err EngineError) Error() string {
	return err.Text
}

func newError(code int, text string) EngineError {
	return EngineError{
		Code: code,
		Text: text,
	}
}
